package com.mlnx.ecg.ui.model;

import java.util.ArrayList;
import java.util.List;

public class Channel {

    private boolean[] channelFlag = new boolean[12];

    private boolean vLeadAsV5 = false;

    public void selectAll() {
        for (int i = 0; i < channelFlag.length; i++) {
            channelFlag[i] = true;
        }
    }

    public void unSelectAll() {
        for (int i = 0; i < channelFlag.length; i++) {
            channelFlag[i] = false;
        }
    }

    public void select(int i) {
        channelFlag[i] = true;
    }

    public void unSelect(int i) {
        channelFlag[i] = false;
    }

    public int getSelectSize() {
        int size = 0;
        for (int i = 0; i < channelFlag.length; i++) {
            if (channelFlag[i]) {
                size++;
            }
        }

        return size;
    }

    public boolean[] getChannelFlag() {
        return channelFlag;
    }

    public List<Integer> getSelectChannelFlag() {

        List<Integer> flagList = new ArrayList();
        for (int i = 0; i < channelFlag.length; i++) {
            if (channelFlag[i]) {
                flagList.add(i);
            }
        }

        return flagList;
    }

    public void setChannelFlag(boolean[] channelFlag) {
        this.channelFlag = channelFlag;
    }

    public boolean isvLeadAsV5() {
        return vLeadAsV5;
    }

    public void setvLeadAsV5(boolean vLeadAsV5) {
        this.vLeadAsV5 = vLeadAsV5;
    }

}
